﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsTest0001
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            string conString = "server=LAPTOP-47B7TGQ4\\SQLEXPRESS;database=Admin001;uid=sa;pwd=2113144056";

            SqlConnection sqlConnection = new SqlConnection(conString);

            string cmdString = "select * from Userso";

            SqlDataAdapter dataAdapter = new SqlDataAdapter(cmdString, sqlConnection);

            DataTable dt = new DataTable();

            sqlConnection.Open();

            dataAdapter.Fill(dt);

            dataGridView1.DataSource = dt;

            
        }
    }
}
